﻿@model PostFormViewModel

@Html.ValidationSummary(true)
  
<div class="editor-label">			
	<label for="Post_Title">@Strings.Title</label>
	@Html.HiddenFor( m => m.Post.PostId )
</div>
<div class="editor-field">		
	@Html.TextBoxFor(m => m.Post.Title, new { size = 60, @class = "titleValue" } )	
	@Html.ValidationMessageFor( m => m.Post.Title )
</div>
@if (User.IsInRole("admin")) { 
	<div class="editor-label">
		<label for="Post_Slug">@Strings.Post_Slug</label>
	</div>
	<div class="editor-field">
		@Html.TextBoxFor(m => m.Post.Slug, new { size = 60, @class = "slug" }) 
		<a href='javascript:void(0);' class='extractSlug'>@Strings.Post_ExtractSlugLinkText</a>
		@Html.ValidationMessageFor(m => m.Post.Slug)
	</div>   
 } 
<div class="editor-label">	
	<label for="Author">@Strings.Post_Author</label>	
</div>
<div class="editor-field">        
	@Html.DropDownList( "authorId", Model.Authors )
</div>
<div class="editor-label">
	<label for="Post_PublishDate">@Strings.Post_PublishDate</label>	    	
</div>
<div class="editor-field">
	@Html.EditorFor( m => m.Post.PublishDate ) 
</div>	            
<div class="editor-field" style="padding:5px 0 5px;">
	@Html.TextAreaFor(m => m.Post.Content, new { style = "height:250px;width:100%;", @class = "mceEditor" })   
	@Html.ValidationMessageFor( m => m.Post.Content )             
</div>		
<div class="editor-label">
	<label for="Post_Description">@Strings.Post_Description</label>	  	
</div>
<div class="editor-field">
	@Html.TextAreaFor(m => m.Post.Description, new { rows = 3, cols = 54 })
</div>
<div class="editor-label">
	<label>@Strings.Categories <span class='famfam active famfam-chart_organisation'></label>	    	
</div>
<div class="editor-field">
	<ul id="categoryCheckboxes">                                
		@{ foreach (SelectListItem category in Model.Categories) {             	
			<li>                
				<input type="checkbox" name="categoryIds" value="@category.Value" @category.Selected  ? "checked='checked'" : ""/>
				@category.Text                
			</li>     	
		 } }
	</ul>
</div>      	
<div class="clearer"></div>
<div class="editor-label">
	<label>@Strings.Tags <span class='famfam active famfam-tag_blue'></span></label>            
</div>        
<div class="editor-field">
	@Html.TextBox("tagList", Model.TagString, new { size = 40 } )      
</div>
<div class="editor-label">
	<label>@Strings.Post_Upload</label>  
</div>
<div class="editor-field">
	<a href="#" id="upload" name="upload">@Strings.Post_UploadLinkText</a>              
</div>	
<hr />
@if( User.InAnyRole(Role.Admin,Role.Editor) ) { 
	<div class="editor-label">
	@Html.Label( Strings.Settings ) 
	</div>
	<div class="editor-field">
		@Html.CheckBoxFor( m => m.Post.AreCommentsEnabled ) @Strings.Post_AreCommentsEnabled 
		@Html.CheckBoxFor( m => m.Post.Featured ) @Strings.Post_Featured 
		@Html.CheckBoxFor( m => m.Post.Published ) @Strings.Post_Published 
	</div>
 } 
<div class="buttons">
	<input type="submit" value="@Strings.Save" />
	<input name="cancel" value="@Strings.Cancel" type="button" onclick="document.location.href=$('#cancelUrl').attr('href')"></input>
	<a id="cancelUrl" href="@Html.AttributeEncode(Url.Action("Manage","Post"))"></a>
</div>
